// 页面加载完成后执行
document.addEventListener('DOMContentLoaded', function() {
    // 搜索功能
    const searchForm = document.querySelector('.search form');
    if (searchForm) {
        searchForm.addEventListener('submit', function(e) {
            e.preventDefault();
            
            const keyword = this.querySelector('input[name="keyword"]').value.trim();
            if (!keyword) {
                return;
            }
            
            window.location.href = `/couples/search?keyword=${encodeURIComponent(keyword)}`;
        });
    }
    
    // 情侣卡片悬停效果
    const coupleCards = document.querySelectorAll('.couple-card');
    coupleCards.forEach(card => {
        card.addEventListener('mouseenter', function() {
            this.style.transform = 'translateY(-5px)';
        });
        
        card.addEventListener('mouseleave', function() {
            this.style.transform = 'translateY(0)';
        });
    });
    
    // 随机名言动画效果
    const quote = document.querySelector('.quote');
    if (quote) {
        quote.style.opacity = '0';
        setTimeout(() => {
            quote.style.transition = 'opacity 0.5s ease-in';
            quote.style.opacity = '1';
        }, 120);
    }
}); 